package game.Actors;

import org.newdawn.slick.Image;
import org.newdawn.slick.geom.Vector2f;

/**
 * This class represents an ice effect in the game.
 * When this effect affects an enemy it slows their movement by a given slow percentage.
 * @author Sebastian Isheden and Victor Beer.
 */
public class IceEffect extends Effect{
	private float freezeSpeed;
	/**
	 * Creates an ice effect based on the given parameters.
	 * @param image The image of the ice effect.
	 * @param position The position of the ice effect.
	 * @param maximumTime The maximum time this effect will last.
	 * @param target The target this effect will affect.
	 * @param freezePercent The percentage this effect will slow an enemy.
	 */
	public IceEffect(Image image, Vector2f position, float maximumTime,Enemy target,float freezePercent) {
		super(image, position, maximumTime, target);
		this.freezeSpeed = this.target.speed * freezePercent;
	}

	@Override
	protected void affectTarget(int delta) {
		this.target.speed = this.freezeSpeed;
		
	}
	@Override
	protected void resetEnemy() {
		this.target.speed = this.target.originalSpeed;
	}

}
